# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>

pkgbase=glibmm
pkgname=(glibmm glibmm-docs)
pkgver=2.66.1
pkgrel=2
pkgdesc="C++ bindings for GLib"
url="https://www.gtkmm.org/"
arch=(x86_64)
license=(LGPL)
depends=(glib2 libsigc++)
makedepends=(git meson mm-common perl-xml-parser clang)
checkdepends=(glib-networking)
options=(!emptydirs)
_commit=6900bf628d07f66e32e2321a46922ebdea15bc21  # tags/2.66.1^0
source=("git+https://gitlab.gnome.org/GNOME/glibmm.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd glibmm
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd glibmm
}

build() {
  arch-meson glibmm build -D maintainer-mode=true
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package_glibmm() {
  depends+=(libsigc-2.0.so)
  provides=(libglibmm-2.4.so)

  meson install -C build --destdir "$pkgdir"

  # Split -docs
  mkdir -p docs/usr/share
  mv -t docs/usr/share "$pkgdir"/usr/share/{devhelp,doc}
}

package_glibmm-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  options=(!strip)

  mv -t "$pkgdir" docs/*
}
